home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Grab Bag
/
Shareware Grab Bag.iso
/
007
/
c80tcog.lbr
/
DAVCOR.CQ
/
davcor.c
Wrap
Text File
|
1985-08-09
|
2KB
|
96 lines
/* davcor.c - utility functions for programs inspired by Cortesi */
/* Version 1.1 1982/12/18 19:19 */
/*
Inspired by the assembly language routine ACTDIR in
David E. Cortesi's INSIDE CP/M: A Guide for Users and Programmers,
Holt, Rinehart and Winston, New York 1982, p. 226-228.
C version:
Copyright 1982 William G. Hutchison, Jr.
P.O. Box 278
Exton, PA 19341-0278
U.S.A.
CompuServe 70665,1307
This program may be used freely for any non-commercial
purpose, provided that the user does not remove or alter
this notice or the copyright statement.
Those who wish to sell or lease this program, or to
incorporate it into a product for sale or lease, should
apply to the author (above) for licensing information.
This program is not covered by a warranty, either
express or implied. The author shall not be responsible for
any damages (including consequential) caused by reliance on
the materials presented, including but not limited to
typographical errors or arithmetic errors.
This version is for C/80 Version 2 from Software Toolworks.
*/
/* over-ride bytes-per-line for Osborne: */
#undef BPL
#define BPL 8
hex_dump(base, len)
char *base;
int len;
{
char *p;
int i;
for (; len > 0; len-= BPL, base+= BPL) {
/*
printf("%4x:", (unsigned)base);
*/
for (p= base, i= (len > BPL)? BPL : len; i > 0; i--)
printf(" %2x", peek(p++));
for (i= BPL-len; i > 0; i--)
printf(" ");
printf(" ");
for (p= base, i= (len > BPL)? BPL : len; i > 0; i--)
printf("%c", printable(*p++));
printf("\n");
}
} /* end of hex_dump */
init_fcb(f, d, fn, ft, x) /* initialize an FCB */
struct fcb *f;
char d, *fn, *ft, x;
{
int i;
f->drv= d;
strmove(fn, f->filename);
strmove(ft, f->type);
f->extent= x;
f->s1= f->s2= f->rec_count= 0;
for (i= 16-1; i >= 0; i--)
f->map[i]= 0;
} /* end of init_fcb */
peek(p)
char *p;
{return (0xFF & *p);}
#ifdef ASCII
printable(c)
char c;
{
return (32 <= c && c <= 127? c : '.');
}
#endif
strmove(from, to) /* move string but not '\0' */
char *from,*to;
{
while (*from)
*to++= *from++;
} /* end of strmove */